<?php
	$query = "Select * from `news` where `lang`='$lang' and `cat`='0' order by `time` desc limit 3";
	//$query = "Select top 3 * from `news` where `lang`='$lang' order by `time` asc";
	$result 		=	 mysql_query($query);
	if (mysql_num_rows($result)) {
		while ($news = mysql_fetch_assoc($result)){
			$time = str_ireplace("%datetime%",date("d-m-Y H:i:s",$news['time']),GetLangString($lang,"txt_newsadded"));
			if ($news['edited'] != 0 ) {
				$time .= " ".GetLangString($lang,"txt_edited")." " . date("d-m-Y H:i:s",$news['edited']); //str_ireplace("%datetime%",date("d-m-Y H:i:s",$news['time']),GetLangString($lang,"txt_newsedited"));
			}
			$sitenews .= FormatElementTime( $news['subject'] , $time , $news['text'] ) ;
		}
	} else {
		$sitenews = 	GetLangString($lang,"txt_nonews");
	}
	$SITE_MIDDLE .= FormatElement( GetLangString ($lang, "txt_news") , bb2html($sitenews) ) ;

?>
